

using System.Reflection;
using foundation;
public class O1Func : IO1Transfrom
{
    public object exec(object root, object property)
    {

        CodeFunctionVO vo = (CodeFunctionVO)property;
        var name = vo.name;

        FuncInfo info = null;
        FuncAttribute.dict.TryGetValue(name, out info);

        if (null != info)
        {
            var propertys = new object[vo.propertys.Length];
            for (int i = 0; i < vo.propertys.Length; i++)
            {
                propertys[i] = O1Exec.codeDoProperty(root, vo.propertys[i]);
            }
            var method = info.method;
            var target = info.target;
            return method.Invoke(target, new object[] { root, propertys });
        }
        else
        {
            UnityEngine.Debug.LogFormat("can't find methon {0}", name);
        }

        return null;
    }
}